/*lic*/
#ifndef __MAIN_H__
#define __MAIN_H__

#include "hc32_ll.h"

#include "BufDef.h"
#include "BaseDef.h"
#include "DeviceDef.h"

// 初始化rt
#include <rthw.h>
#include <rtthread.h>
#include <rtdef.h>

#include <stdbool.h>

#define SDRAM3_POOL_START 0x20040000
#define SDRAM3_POOL_END 0x2004FFFF
#define SDRAM3_VAL_START 0x20050000
#define SDRAM3_VAL_END 0x20057FFF
// ECC
#define SDRAM4_START 0x20058000 
#define SDRAM4_END 0x2005FFFF

// 定义data_event事件集事件
extern struct rt_event chip_device_event;
#define CHIP_DEVICE_EVENT__TRNG_FINISHED (1 << 0)
#define CHIP_DEVICE_EVENT__OTS_FINISHED (1 << 1)


// 发送完成解锁信号量。用来解决DMA的异步发送阻塞问题
extern rt_sem_t debug_usart_sem;
extern struct rt_messagequeue debug_usart_mq;
extern char debug_usart_tx_buf[256];
extern size_t led_busy_times;
// 创建控制台接收邮箱
extern struct rt_messagequeue finsh_usart_mq;

// 字符串转换函数
int itoa(int n, char *str, int zero);

#endif /* __MAIN_H__ */

/*eof*/
